#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    bool canConstruct(string ransomNote, string magazine)
    {
        unordered_map<char, int> map;
        for (auto ch : magazine)
        {
            map[ch]++;
        }
        for (auto ch : ransomNote)
        {
            if (map.find(ch) != map.end())
            {
                map[ch]--;
                if (map[ch] < 0)
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        return true;
    }
};

int main()
{
    string str1{"a"};
    string str2{"b"};
    Solution sol;
    cout << sol.canConstruct(str1, str2) << endl;
    return 0;
}